from django.urls import path
from apps.goods.views import IndexView,ListView,HotGoodsView,MySearchView,DetailView,DetailVisitView
urlpatterns = [
    #/index 首页渲染
    path('index/',IndexView.as_view()),
    #/www.meiduo.site:8000/list/115（三级标题）/skus/?page=页码&page_size=总页数&ordering=排序规则
    path('list/<id>/skus/',ListView.as_view()), #列表页数据
    #http://www.meiduo.site:8000/hot/(三级标题)/
    path('hot/<id>/',HotGoodsView.as_view()), #热销排行数据
    #www.meiduo.site:8000/search/?q=关键词&page=1&page_size=6
    path('search/',MySearchView()),
    #/detail/三级标题/
    path('detail/<sku_id>/',DetailView.as_view()), #商品详细页
    #/detail/visit/商品分类id/
    path('detail/visit/<category_id>/',DetailVisitView.as_view()),
]

#商品评论url生成
from rest_framework import routers
from apps.goods.views import GoodsCommentModelViewSet
router=routers.DefaultRouter()
router.register('comments',GoodsCommentModelViewSet,basename='comment')
urlpatterns+=router.urls
